<?php
/**
 * Created by PhpStorm.
 * User: dingboxu
 * Date: 17/2/21
 * Time: 下午6:04
 */

//$httpUrl = "http://192.168.1.113:8088/";
$httpUrl = "http://192.168.1.127:8088/";
//$httpUrl = "http://115.29.136.117:8088/";

//  -----  商品标签管理  -----
// 添加标签
$food_tag_add = array(
    "ActionType" => "event_restaurant_food_tags_add",
    "DataDictionary" => array(
        "FOOD_TAG_NAME" => "测试标签",
        "FOOD_TAG_COLOR" => "red"
    )
);

// 删除标签
$food_tag_delete = array(
    "ActionType" => "event_restaurant_food_tags_delete",
    "DataDictionary" => array(
        "FOOD_TAG_ID" => 1
    )
);

// 更新标签
$food_tag_update = array(
    "ActionType" => "event_restaurant_food_tags_update",
    "DataDictionary" => array(
        "FOOD_TAG_ID" => 1,
        "FOOD_TAG_NAME" => "测试标签11",
        "FOOD_TAG_COLOR" => "red"
    )
);

// 获取标签列表
$food_tag_get_list = array(
    "ActionType" => "event_restaurant_food_tags_get_list",
    "DataDictionary" => array(
    )
);

// 获取单个标签
$food_tag_get_record = array(
    "ActionType" => "event_restaurant_food_tags_get_record",
    "DataDictionary" => array(
        "FOOD_TAG_ID" => 1,
    )
);


//  -----  商品分类管理  -----
// 添加分类
$food_group_add = array(
    "ActionType" => "event_restaurant_food_groups_add",
    "DataDictionary" => array(
        "FOOD_GROUP_NAME" => "测试分类",
        "DESCRIPTION" => "我是介绍"
    )
);
// 删除分类
$food_group_delete = array(
    "ActionType" => "event_restaurant_food_groups_delete",
    "DataDictionary" => array(
        "FOOD_GROUP_ID" => 1
    )
);
// 更新分类
$food_group_update = array(
    "ActionType" => "event_restaurant_food_groups_update",
    "DataDictionary" => array(
        "FOOD_GROUP_ID" => 1,
        "FOOD_GROUP_NAME" => "嘻嘻",
        "DESCRIPTION" => "介绍介绍"
    )
);
// 获取分类列表
$food_group_get_list = array(
    "ActionType" => "event_restaurant_food_groups_get_list",
    "DataDictionary" => array(
    )
);
// 获取单个分类
$food_group_get_record = array(
    "ActionType" => "event_restaurant_food_groups_get_record",
    "DataDictionary" => array(
        "FOOD_GROUP_ID" => 1,
    )
);

//  -----  商品管理  -----
// 添加商品
$food_add = array(
    "ActionType" => "event_restaurant_food_add",
    "DataDictionary" => array(
        "FOOD_GROUP_ID" => "1",
        "FOOD_TAG_ID" => "5",
        "DESCRIPTION" => "描述1",
        "FOOD_NAME" => "商品1",
        "IMG_URL" => "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2390973038,561107391&fm=23&gp=0.jpg",
        "FOOD_PRICE" => "12.50",
        "IS_LIMIT" => "1",
        "LUNCHBOX_AMOUNTS" => "2",
        "LUNCHBOX_PRICE" => "2.5",
        "IS_ON_SELL" => "1",
        "STOCK_DAY" => "100",
        "STOCK_LEFT" => "50",
        "SPECIAL_FEATURE" => "1",
        "ORDER_UNIT" => "份",
        "ORDER_MINIMUM" => "1",
    )
);

// 删除商品
$food_delete = array(
    "ActionType" => "event_restaurant_food_delete",
    "DataDictionary" => array(
        "FOOD_ID" => 5
    )
);

// 更新商品
$food_update = array(
    "ActionType" => "event_restaurant_food_update",
    "DataDictionary" => array(
        "FOOD_ID" => 1,
        "FOOD_GROUP_ID" => 2,
        "FOOD_TAG_ID" => 5,
        "FOOD_NAME" => "商品1update",
        "DESCRIPTION" => "描述111",
        "IMG_URL" => "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2390973038,561107391&fm=23&gp=0.jpg",
        "FOOD_PRICE" => "12.80",
        "IS_LIMIT" => "1",
        "LUNCHBOX_AMOUNTS" => "2",
        "LUNCHBOX_PRICE" => "2.5",
        "IS_ON_SELL" => "1",
        "STOCK_DAY" => "100",
        "STOCK_LEFT" => "50",
        "SPECIAL_FEATURE" => "1",
        "ORDER_UNIT" => "份1",
        "ORDER_MINIMUM" => "1",
        "FOOD_PROPERTY" => "微辣1",

    )
);

// 获取商品列表
$food_get_list = array(
    "ActionType" => "event_restaurant_food_get_list",
    "DataDictionary" => array(
    )
);

// 获取单个商品
$food_get_record = array(
    "ActionType" => "event_restaurant_food_get_record",
    "DataDictionary" => array(
        "FOOD_ID" => 1
    )
);

// 上架、下架商品
$food_sell_change = array(
    "ActionType" => "event_restaurant_food_sell_change",
    "DataDictionary" => array(
        "FOOD_ID" => 1,
        "IS_ON_SELL" => 0
    )
);


//  ------- 桌子管理  --------

// 添加桌子
$table_add = array(
    "ActionType" => "event_table_add",
    "DataDictionary" => array(
        "TABLE_NUM" => 1,
        "MAX_CAPACITY" => 10,
    )
);
// 更新桌子
$table_update = array(
    "ActionType" => "event_table_update",
    "DataDictionary" => array(
        "TABLE_ID" => 1,
        "TABLE_NUM" => 2,
        "MAX_CAPACITY" => 22,
    )
);
// 获取单个桌子
$table_get_record = array(
    "ActionType" => "event_table_get_record",
    "DataDictionary" => array(
        "TABLE_ID" => 1,
    )
);
// 获取桌子列表
$table_get_list = array(
    "ActionType" => "event_table_get_list",
    "DataDictionary" => array(
    )
);
// 删除桌子
$table_delete = array(
    "ActionType" => "event_table_delete",
    "DataDictionary" => array(
        "TABLE_ID" => 1,
    )
);


$post_data = json_encode($food_sell_change);

echo "$post_data<br><br><br>";
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $httpUrl );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
// post传参
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec ( $ch );
curl_close ( $ch );

echo $result;

